package android07.newtop.presenter;

import android.content.Context;
import android.content.Intent;

import com.jude.beam.expansion.data.BeamDataActivityPresenter;

import android07.newtop.activity.LaunchActivity;
import android07.newtop.activity.MainActivity;
import android07.newtop.model.LaunchBeanModel;
import android07.newtop.model.bean.LaunchBean;


/**
 * 主要控制LaunchActivity 的数据获取，展示 跳转等等
 * <p>
 * <p>
 * Created by hy on 2016/7/7.
 * hdh
 */
public class LaunchActivityPresenter extends BeamDataActivityPresenter<LaunchActivity, LaunchBean> {


    /**
     * activity 刚起床， 睁开眼的那一刻 执行
     *
     * @param view
     */
    @Override
    protected void onCreateView(LaunchActivity view) {
        super.onCreateView(view);
        //睁开眼，要干啥 ，要喝奶 按时

        //这里会将bean 填充到Activity中的 setData()方法
        getDataSubscriber().onNext(new LaunchBeanModel().getLaunchBean(view));


    }


    /**
     * 跳转到主页面
     *
     * @param context
     */
    public void startMainActivity(LaunchActivity context) {
        Intent intent = new Intent(context, MainActivity.class);
        context.startActivity(intent);
        context.finish();

    }


}
